<template>
    <div>
        <!-- 雷达图 -->
        <div id="main" style="width: 80vw;height:70vh;" class="bg"></div>
    </div>
</template>

<script setup>
import * as echarts from 'echarts';
import { onMounted } from 'vue'

onMounted(()=>{

 var myChart = echarts.init(document.getElementById('main'));
  window.addEventListener('resize', function() {
    myChart.resize();
  });
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;

option = {
  legend: {
    data: ['Allocated Budget', 'Actual Spending']
  },
  radar: {
    // shape: 'circle',
    indicator: [
      { name: '体重', max: 6500 },
      { name: '打败', max: 16000 },
      { name: '完成目标', max: 30000 },
      { name: '奋斗值', max: 38000 },
      { name: '身体年龄', max: 52000 },
      { name: '运动量', max: 25000 }
    ]
  },
  series: [
    {
      name: 'Budget vs spending',
      type: 'radar',
      data: [
        {
          value: [4200, 5000, 20000, 35000, 50000, 18000],
        //   name: 'Allocated Budget'
        },
        {
          value: [5000, 14000, 28000, 26000, 42000, 21000],
        //   name: 'Actual Spending'
        }
      ]
    }
  ]
};

option && myChart.setOption(option);
})
</script>

<style lang="scss" scoped></style>